home *** CD-ROM | disk | FTP | other *** search
- #include <iostream.h>
- #include <assert.h>
- #include <stdio.h>
-
- main ()
- {
- char ch;
- int i;
-
- filebuf finbuf;
- finbuf.open("ffile", ios::in);
- istream fin(&finbuf);
- assert(fin.good());
- assert(fin.is_open());
- assert(!fin.writable());
- assert(fin.readable());
- cout << "contents of file:\n";
-
- do
- {
- i = ((fin >> ch) ? 1 : 0);
- fprintf(stderr, "i is %d\n", i);
- if(!i)
- break;
- cout << ch;
- } while(1);
-
- fin.close();
- assert(!fin.is_open());
- cout << "\nAlldone\n";
- }
-